package com.ruoyi.flow.common.config;

import com.ruoyi.flow.common.config.Global;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @Author: wtian
 * @Description:
 * @Date: Created in 12:44 2018/8/10
 * @Version: 1.0
 */
public class FlowConfigListener implements ServletContextListener {
    private ServletContext context;

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        this.context = servletContextEvent.getServletContext();
        String systemName = com.ruoyi.flow.common.config.Global.getString("system.name", "");
        this.context.setAttribute("systemName", systemName);
        int pageSize = Global.getInt("web.page.pagesize", 10);
        this.context.setAttribute("pageSize", pageSize);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        this.context = null;
    }
}
